#pragma once

#include "MyProtocol.h"	// For protocol attribute.

namespace CO { namespace MyGroupNamespace { namespace MyPackageNamespace {

//
// TODO:  Add a smart pointer typedef for your class.
//
class MyActiveInterface;
typedef ::boost::shared_ptr<MyActiveInterface> MyActiveInterfaceSP;

//
// Interface definition.
//
class MyActiveInterface :
	public virtual SpiFoundation::RoomFW::IActiveObject,
	public SpiFoundation::Interface::ISystemComponent
{
public:

	//
	// TODO:  Add an enumeration value for each sub-class.
	//
	enum SubClass 
	{
		MY_ACTIVE_OBJECT,
		MY_ACTIVE_HSM,
		MY_ACTIVE_OBJECT_CONTAINER,
		MY_HSM_MESSAGE_HANDLER,
	};
	//
	// "Factory Method" to hide implementation details.
	//
	static MyActiveInterfaceSP Create(SubClass type);

	//
	// TODO:  Add an enumeration value for each port.
	//
	enum PortEnum 
	{
		PORT_SYSTEM,
		PORT_MY_PORT_1,
		PORT_MY_PORT_2,
		PORT_MY_PORT_3,
		//
		// TODO:  Add additional ports.  I.e.  PORT_MY_PORT_X etc.
		//
		PORT_COUNT,				// Number of user defined ports.
		PORT_TIMER = PORT_COUNT // Port index used to handle timer messages.
	};

	//
	// Static array used to assign port priorities in the same order ports are
	// named above.  Must have PORT_COUNT + 1 Elements.  Last element for timer.
	//
	static const PortPriority PortPriorities[];
	static const size_t PortPrioritiesSize;

	//
	// Constructor/Destructor.
	//
	MyActiveInterface(void);
	virtual ~MyActiveInterface(void);

	//
	// IActiveObject overrides.
	//
	virtual const char* getPortName(size_t portIndex) const;
	SpiFoundation::RoomFW::IContractCheckerSPC getContractChecker(SpiFoundation::RoomFW::PortIndex portIndex) const;

	//
	// ISystemComponent overrides.
	//
	virtual SpiFoundation::RoomFW::PortIndex::PrimaryIndex getSystemPort(void) const;

private:

	//
	// TODO:  Add a protocol member for each port to return from getContractChecker()
	//			rather than dynamically allocating a new one each time.
	//
	SystemManagerProtocol systemProtocol_;
	MyProtocol myProtocol_1_;
	MyProtocol myProtocol_2_;

};

}}} // End namespace
